home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-18 | 7.4 KB | 241 lines | [TEXT/MMCC] |
- /******************** ***********************/
- //
- // Player PRO 4.2 -- MAD Music Driver Definition
- //
- // Library Version 2.5
- //
- // To use with MusicLibrary 2.5 for Think C & CodeWarrior
- //
- // Antoine ROSSET
- // 16 Tranchees
- // 1206 GENEVA
- // SWITZERLAND
- //
- // FAX: (+41 22) 346 11 97
- // Compuserve: 100277,164
- // Internet: rosset@dial.eunet.ch
- //
- /******************** ***********************/
-
- #define MAX_ARP 3
- #define NUMBER_FINETUNES 17
- #define AMIGA_CLOCKFREQ 33659820
- #define MIN_PITCH 142
- #define MAX_PITCH 17161L
- #define MIN_VOLUME 0
- #define MAX_VOLUME 64
- #define ACCURACY 12
- #define fix_to_int(x) ((x) >> ACCURACY)
- #define int_to_fix(x) ((x) << ACCURACY)
- #define FREQBASE 152L
- #define MAXTRACK 32
- #define MAXINSTRU 64
- #define MAXPATTERN 200
- #define NUMBER_NOTES 84
-
- /******************** ***********************/
- /*** Voice structure definition ***/
- /******************** ***********************/
-
- struct VoiceActive {
- Ptr MaxPtr;
- Ptr InstruVoice;
- Ptr StartPtr;
- long loopWord;
- long loopWords;
-
- short Instru;
- short InstruOld;
-
- short Amiga;
- short AmigaOld;
-
- short pitch;
- short realpitch;
-
- short volume;
- short effect;
- Byte arg;
-
- short arp[MAX_ARP];
- short arpindex;
-
- short viboffset;
- short vibdepth;
- short slide;
- short pitchgoal;
- short pitchrate;
- short oldpitchrate;
- short volumerate;
- short vibrate;
- short oldvibrate;
- short retrig;
-
- short ID;
- short amplitude;
- };
- typedef struct VoiceActive VoiceActive;
-
- /******************** ***********************/
- /*** Music description used in driver ***/
- /******************** ***********************/
-
- struct MADPartition
- {
- MADSpec* header;
- struct MusicPattern* partition[ MAXPATTERN];
- Ptr instrument[ MAXINSTRU];
- };
- typedef struct MADPartition MADPartition;
-
- /******************** ***********************/
- /*** PlayerPRO variables ***/
- /******************** ***********************/
-
- #ifdef MainSystemPlayerPRO
- #define EXT
- #else
- #define EXT extern
- #endif
-
- EXT MADPartition thePartition; // Current music in memory, loaded with RLoadMusic() by example
- EXT MADSpec *theFileInt; // Current music header == thePartition.header
- EXT VoiceActive theVoiceActive[ MAXTRACK]; // Current driver voices
- EXT short DriverTypeInt; // Actual driver type
- EXT short Tube[ MAXTRACK]; // Used in 'Tracks View' Window - View menu
- EXT short PartitionReader; // Current position in pattern (0...64)
- EXT short Pat; // Current ID Pattern, see 'Patterns list'
- EXT short PL; // Current position in partition, see 'Partition list'
- EXT short VolExt[ MAXTRACK]; // Volumes settings, see 'Adaptators' window
- EXT short speed; // Current speed, see speed Effect
- EXT short finespeed; // Current finespeed, see speed Effect
- EXT short InstruTube[ MAXINSTRU]; // Used in 'Instrument View' Window - View menu
- EXT short VExt; // External music speed, see 'Adaptators' window
- EXT short FreqExt; // External music pitch, see 'Adaptators' window
- EXT short DriveTrackNo; // Actual number of tracks
- EXT short DriveOutBit; // Output bit: 8 or 16 bits
- EXT Boolean PtrSystem; // Use NewPtr or NewPtrSys ?
- EXT Boolean Reading; // Reading indicator
- EXT Boolean MusiqueFertig; // Is your music finished?
-
- /* DO NOT MODIFY OR USE these variables */
-
- EXT short smallcounter, trackDiv;
- EXT long DBTick, ASCBUFFER;
- EXT short **FreqHandle, InstruActif[ MAXINSTRU];
- EXT Ptr SysHeapPtr, Vol, IntPtr[ 2], PseudoBuf[ 2];
- EXT Boolean SMTicker, RepeatMusic, JumpToNextPattern;
- EXT long oldNotePosAA, SInc, VMOD;
- EXT Boolean DriveStereo, PtrSystem, JumpToNextPattern, RepeatMusic;
-
- extern short Tuning[ ], vibrato_table[ ];
-
- /******************** ***********************/
- /*** DRIVERS ID ***/
- /*** DO NOT USE MIDIClassic Driver !!!! ***/
- /******************** ***********************/
-
- enum {
- ASCMono = 1,
- ASCStereo = 2,
- SMMono = 3,
- SMStereo = 4,
- SMDSP = 5,
- SMPolyPhonic = 6,
- MIDIClassic = 7
- };
-
- /******************** ***********************/
- /*** EFFECTS ID ***/
- /******************** ***********************/
-
- enum {
- arpeggioE = 0,
- downslideE = 1,
- upslideE = 2,
- portamentoE = 3,
- vibratoE = 4,
- portaslideE = 5,
- vibratoslideE = 6,
- nothingE = 7,
- offsetE = 9,
- slidevolE = 10,
- fastskipE = 11,
- volumeE = 12,
- skipE = 13,
- extendedE = 14,
- speedE = 15
- };
-
- /******************** ***********************/
- /* General Function Description */
- /* For more informations about these functions, e-mail me */
- /******************** ***********************/
-
-
- /******************** ***********************/
- /*** EXTERNAL ROUTINES ***/
- /*** See Documentation for more informations on these routines ***/
- /******************** ***********************/
-
- OSErr RInitMusic( short, short); // Music Driver initialization
- OSErr RPlayMusic( void); // Play the current music
- OSErr RStopMusic( void); // Stop the current music
- OSErr RResetMusic( void); // Reset the current music at the start position
- OSErr RQuitMusic( void); // Dispose the music driver, use it after RInitMusic()
-
- OSErr RLoadMusic( Str255 fName); // Load a MAD File in the current directory
- OSErr RLoadMusicRsrc( OSType IDName, short IDNo); // Load a MAD Rsrc into memory
- OSErr RInstallMADF( MADPartition aPartition); // Install directly a MAD partition
- OSErr RClearMusic(void); // Dispose the current music, use it after RLoadMusic(), RLoadMusicRsrc(), RInstallMADF()
-
-
- void ConvertMod2Mad( Ptr aMOD, long Size, MADPartition *theMAD); // Convert MOD to MAD
- Ptr ConvertMad2Mod( MADPartition *theMAD, long Size); // Convert MAD to MOD
- void ChangeTrackNo( short); // Change the current tracks number of the music driver
- void CleanDriver( void); // Clean the driver
- struct Command* GetCommand( short PosX, short TrackIdX, struct MusicPattern* tempMusicPat); // Extract a Command from a MusicPattern
-
- /******************** ***********************/
- /*** INTERNAL ROUTINES ***/
- /*** DO NOT use these routines ***/
- /******************** ***********************/
-
- void Sampler8in8Add( VoiceActive *curVoice, register Ptr ASCBuffer);
- void Sampler16Add( VoiceActive *curVoice, register short *ASCBuffer);
-
- void NoteAnalyse( void);
-
- void ClearVol4();
- OSErr SetUpFrequence( long, long);
- OSErr ReadInstrument( short, Boolean, Handle);
- void DoEffect( VoiceActive *, short);
- OSErr DBSndClose();
- void StopChannel();
- OSErr SetMODVol4( long , long , Boolean );
- void PlayChannel();
- void checkpitch( VoiceActive *, Boolean);
- void BufferCopyM();
- void BufferCopyS();
- void InstallMODVBL(void);
- void ReadNote( VoiceActive *curVoice, struct Command *theCommand);
- void RemoveMODVBL(void);
- void MODRelance(void);
- void Play(void);
- void VIAOn(void);
- void SndOff(void);
- void SndOn(void);
- void VIAOn2(void);
- void VIAOn3(void);
- OSErr InitDBSoundManager( long);
- void SetUpEffect( VoiceActive *ch);
- Boolean DirectSave( Ptr, Boolean, short);
- void ChangeSpeed( void);
- void Play16Stereo( void);
- void Play8Stereo( void);
- void Play8Mono( void);
- long decode32 (void *msg_buf);
- short decode16 (void *msg_buf);
- long Tdecode32 (void *msg_buf);
- short Tdecode16 (void *msg_buf);
- void ClearFrequence();